package com.gzsxy.esjy.service.core.sign.controller;

import com.gzsxy.esjy.service.base.dto.response.DefaultResponse;
import com.gzsxy.esjy.service.core.sign.dto.DocumentSignDto;
import com.gzsxy.esjy.service.core.sign.entity.ArraignSign;
import com.gzsxy.esjy.service.core.sign.service.SignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhangxiaolong
 * @date 2022/7/12 16:36
 */
@CrossOrigin  //解决跨域
@RestController
@RefreshScope    //动态刷新配置文件-外部配置文件
@RequestMapping("/esjy/sign")
@Api(tags = "电子签名",value = "电子签名")
public class SignController {

    @Autowired
    private SignService signService;


    @PostMapping("documentSign")
    @ApiOperation("文书签名")
    public void documentSign(@RequestBody DocumentSignDto documentSignDto){
        signService.documentSign(documentSignDto);
    }

    @PostMapping("documentCancelSign")
    @ApiOperation("文书取消签名")
    public void documentCancelSign(@RequestBody DocumentSignDto documentSignDto){
        signService.documentCancelSign(documentSignDto);
    }


    @PostMapping("/documentSeal")
    @ApiOperation("文书盖章")
    public DefaultResponse documentSeal(@RequestBody DocumentSignDto dto){
        ArraignSign arraignSign = signService.documentSeal(dto);
        return DefaultResponse.ok(arraignSign);
    }


    @PostMapping("/documentDate")
    @ApiOperation("文书添加日期")
    public DefaultResponse documentDate(@RequestBody DocumentSignDto dto){
        ArraignSign arraignSign = signService.documentDate(dto);
        return DefaultResponse.ok(arraignSign);
    }

}
